home *** CD-ROM | disk | FTP | other *** search
- Path: news.mountain.net!usenet
- From: gene_heskett@wvlink.mpl.com (Gene Heskett)
- Newsgroups: comp.sys.amiga.programmer
- Subject: Re: Is this a SAS/C bug or have I coded it wrong?
- Date: 7 Jan 1996 17:57:00 GMT
- Organization: MountainNet, Inc. Morgantown WV 800.444.1458
- Message-ID: <1784.6580T49T1764@wvlink.mpl.com>
- References: <4cfrc5$gsc@misery.millcomm.com>
- NNTP-Posting-Host: slip3.mpl.com
- X-Newsreader: THOR 2.22 (Amiga;TCP/IP)
-
- Y> Is this a SAS/C bug or am I getting more blind???
-
- Y> ======================================================================
- Y> === The following code:
- Y> ======================================================================
- Y> ===
-
- Y> tmpbuf[10];
-
- Y> int
- Y> test( void )
- Y> {
-
- Y> if ( tmpbuf[0] & 0x1f == 1 )
- Y> return 1;
-
- Y> return 0;
- Y> }
-
- Y> ======================================================================
- Y> === Produces:
- Y> ======================================================================
- Y> ===
- Y> SECTION text,CODE
- Y> __code:
- Y> test:
- Y> ___test__1:
- Y> MOVEQ.L #$0,D0 ;7000
- Y> ___test__2:
- Y> RTS ;4e75
- Y> __const:
- Y> __strings:
- Y> XDEF test
- Y>
- Y> SECTION __MERGED,BSS
- Y> __MERGEDBSS
- Y> tmpbuf:
- Y> DS.B 40
- Y> XDEF tmpbuf
- Y> END
- Y> ======================================================================
- Y> === Is this right? Where'd the "IF" go? Do I have it coded wrong?
-
-
- Y> if ( tmpbuf[0] & 0x1f == 1 )
-
- Well, while your code *may* be legal, I think what you wanted was:
- if ( (tmpbuf[0] & 0x1f) == 1 )
- which could be simplified to:
- if (tmpbuf[0] & 0x01)
- since you are asking in fact if the least significant bit is set.
- But I don't claim to be a guru.
-
-
- /* Gene Heskett | These opinions are NOT to be */
- /* CE @ WDTV Weston/Clarksburg WV | confused with the official */
- /* <gene_heskett@wvlink.mpl.com> | WDTV managment views */
- #include <std.disclaimer>
-
-
-